<template>
  <div>
    <el-form ref="form"  label-width="80px">
      <el-form-item label="链接类型">
        <el-radio-group v-model="from.radio">
          <el-radio :label="1">站内链接</el-radio>
          <el-radio :label="2">站外链接</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="站内链接" v-if="from.radio==1">
           <el-select v-model="from.link" placeholder="请选择">
                <el-option
                v-for="item in globaleCanvasData"
                :key="item.name"
                :label="item.pagename"
                :value="item.name">
                </el-option>
            </el-select>
      </el-form-item>
         <el-form-item label="站外链接" v-if="from.radio==2">
           <el-input
                placeholder="http://"
                v-model="from.link"
                clearable>
                </el-input>
      </el-form-item>
          <el-form-item >
            <el-checkbox v-model="from.target">在新页面打开</el-checkbox>
       </el-form-item>

      <el-form-item class="flex-end">
        <el-button type="primary" @click="onSubmit">确定</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
    data() {
        return {
            from:{
                radio:1,
                link:'',
                target:false
            },
            globaleCanvasData:[],
        }
    },
    methods:{
        onSubmit(){
            this.$emit("closeTK",this.from)
        },
    },
    created(){
        this.globaleCanvasData=JSON.parse(localStorage.getItem('GlobalcanvasData')) 
    },
};
</script>

<style>
</style>